package com.maccuoi.letsgo;

import java.util.Map;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

public class AppMessageBox {
	public static void alert(Context ctx, String title, String msg) {
		AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();

		// Setting Dialog Title
		alertDialog.setTitle(title);

		// Setting Dialog Message
		alertDialog.setMessage(msg);
		alertDialog.setButton("Ok", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		alertDialog.show();
	}
	
	@SuppressWarnings("deprecation")
	public static void alert(Context ctx, String title, String msg, Map<String, Object> buttons) {
		AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();

		// Setting Dialog Title
		alertDialog.setTitle(title);

		// Setting Dialog Message
		alertDialog.setMessage(msg);
		for (String key : buttons.keySet()) {
			alertDialog.setButton(key.toString(),(OnClickListener) buttons.get(key));
		}
		alertDialog.show();
	}
}